<template>
    <div class="app-container">
        <el-card shadow="always">
            <el-form :model="queryParams" :inline="true" label-width="100px">
                <el-form-item label="所属区县：" prop="county">
                    <el-select v-model="queryParams.county" placeholder="请选择所属区县" clearable style="width: 240px">
                        <el-option v-for="dict in nhp_county_type_short" :key="dict.value" :label="dict.label"
                            :value="dict.value" />
                    </el-select>
                </el-form-item>
                <el-form-item label="网络制式：" prop="networkType">
                    <el-select v-model="queryParams.networkType" placeholder="请选择网络制式" clearable style="width: 240px">
                        <el-option v-for="dict in nhp_network_type" :key="dict.value" :label="dict.label"
                            :value="dict.value" />
                    </el-select>
                </el-form-item>
                <el-form-item label="小区名">
                    <el-input v-model="queryParams.cellName" clearable placeholder="请输入小区名" style="width: 240px" />
                </el-form-item>
                <el-form-item label="基站名">
                    <el-input v-model="queryParams.siteName" clearable placeholder="请输入基站名" style="width: 240px" />
                </el-form-item>
                <el-form-item label="站型">
                    <el-select v-model="queryParams.siteType" placeholder="请选择站型" clearable style="width: 240px">
                        <el-option v-for="item in siteTypeOptions" :key="item.value" :label="item.key"
                            :value="item.value" />
                    </el-select> </el-form-item>
                <el-form-item>
                    <el-button type="primary" icon="Search" @click="listCellInfoList">查询</el-button>
                    <el-button @click="unsetQueryForm"><el-icon>
                            <RefreshRight />
                        </el-icon>重置</el-button>
                </el-form-item>

            </el-form>
        </el-card>
        <el-card shadow="always" style="margin-top: 10px;min-height: 500px;padding-bottom: 3px;">
            <el-row>
                <el-button type="primary" icon="Upload" @click="uploadOssData">导入</el-button>
                <!-- <el-button type="primary" icon="Download">导出</el-button> -->
                <el-button type="primary" icon="List" @click="showAuditResult">稽核分析结果</el-button>
            </el-row>
            <div id="table" style="margin-top: 20px;">
                <el-table v-loading="loading" ref="cellInfoTable" :data="cellInfoTableData" style="width: 100%"
                    @sort-change="sortChange" @filter-change="filterChange">
                    <el-table-column prop="id" label="ID" width="100" align="center" fixed />
                    <el-table-column prop="county" label="区县" width="120" align="center" fixed />
                    <el-table-column prop="siteName" label="基站名" width="250" align="center" show-overflow-tooltip />
                    <el-table-column prop="cellName" label="小区名" width="200" align="center" fixed />
                    <el-table-column prop="siteId" label="站号" width="120" align="center" />
                    <el-table-column prop="enbid" label="eNBID" width="120" align="center" />
                    <el-table-column prop="localCellId" label="本地小区ID" width="120" align="center" />
                    <el-table-column prop="eci" label="ECI" width="120" align="center" />
                    <el-table-column prop="physicalCellId" label="物理小区标识" width="120" align="center" />
                    <el-table-column prop="pciMod3" label="PCIMOD3" width="120" align="center" />
                    <el-table-column prop="tac" label="跟踪区" width="120" align="center" />
                    <el-table-column prop="longitude" label="经度" width="150" align="center" />
                    <el-table-column prop="latitude" label="纬度" width="150" align="center" />
                    <el-table-column prop="frequencyBand" label="频段" width="120" align="center" />
                    <el-table-column prop="frequencyPoint" label="频点号" width="120" align="center" />
                    <el-table-column prop="bandwidth" label="带宽" width="120" align="center" />
                    <el-table-column prop="siteType" label="站型" width="120" align="center" />
                    <el-table-column prop="azimuth" label="方位角" width="120" align="center" />
                    <el-table-column prop="stationHeight" label="站高" width="120" align="center" />
                    <el-table-column prop="totalPitchAngle" label="总俯仰角" width="120" align="center" />
                    <el-table-column prop="innerPitchAngle" label="内置下倾角" width="120" align="center" />
                    <el-table-column prop="electronicPitchAngle" label="电下倾角" width="120" align="center" />
                    <el-table-column prop="mechanicalPitchAngle" label="机械下倾角" width="120" align="center" />
                    <el-table-column prop="sprodName" label="厂家" width="120" align="center" />
                    <el-table-column prop="hpbw" label="半功率角" width="120" align="center" />
                    <el-table-column prop="gridInfo" label="网格信息" width="150" align="center" />
                    <el-table-column prop="bandType" label="类型" width="150" align="center" />
                    <el-table-column prop="commonSiteName" label="共站名" width="150" align="center" />
                    <el-table-column prop="sectorName" label="扇区名" width="150" align="center" />
                    <el-table-column prop="sector" label="扇区" width="150" align="center" />
                    <el-table-column prop="description" label="描述" width="200" align="center" />
                    <el-table-column prop="addTime" :formatter="dateFormatter" label="添加时间" width="160"
                        align="center" />
                    <el-table-column prop="enodebOffcsite" label="enodebOffcsite" width="150" align="center" />
                    <el-table-column prop="isRemote" label="是否远端拉远" width="150" align="center" />
                    <el-table-column prop="relatedOffcsite" label="relatedOffcsite" width="150" align="center" />
                    <el-table-column prop="rruModel" label="RRU的DN" width="150" align="center" />
                    <el-table-column prop="rruNumber" label="RRU个数" width="120" align="center" />
                    <el-table-column prop="ossCellName" label="资管小区名" width="150" align="center" />
                    <el-table-column prop="ossSiteName" label="资管基站名" width="150" align="center" />
                    <el-table-column prop="networkType" label="网络类型" width="120" align="center" />
                    <el-table-column prop="physicalSiteId" label="物理站ID" width="150" align="center" />
                    <el-table-column prop="physicalSiteName" label="物理站名称" width="200" align="center" />
                    <el-table-column prop="areaType" label="区域类型" width="150" align="center" />
                    <el-table-column prop="physicalSiteLongitude" label="物理站经度" width="150" align="center" />
                    <el-table-column prop="physicalSiteLatitude" label="物理站纬度" width="150" align="center" />
                    <el-table-column prop="towerType" label="塔型" width="150" align="center" />
                    <el-table-column prop="towerSpecificType" label="具体塔型" width="150" align="center" />
                    <el-table-column fixed="right" label="操作" min-width="120" align="center">
                        <template #default="scope">
                            <el-button link type="primary" size="small"
                                @click="showDetailDialog(scope.row.id)">详情</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <!-- <el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
                    :page-sizes="[10, 50, 100, 200]" layout="total, sizes, prev, pager, next" :total="total"
                    @size-change="listCellInfoList" @current-change="listCellInfoList" /> -->
                <pagination v-show="total > 0" :total="total" v-model:page="currentPage" v-model:limit="pageSize"
                    @pagination="listCellInfoList" :autoScroll="false" />
            </div>
        </el-card>
        <el-dialog v-model="detailDialogVisible" title="查看小区详情" width="1200" @closed="closeDialog">
            <el-form :inline="true" :model="cellInfoForm" label-width="100px">
                <el-form-item label="所属区县">
                    <el-input v-model="cellInfoForm.county" disabled style="width: 200px" />
                </el-form-item>
                <el-form-item label="基站名">
                    <el-input v-model="cellInfoForm.siteName" disabled style="width: 670px" />
                </el-form-item>
                <el-form-item label="小区名">
                    <el-input v-model="cellInfoForm.cellName" disabled style="width: 1000px" />
                </el-form-item>
                <el-form-item label="站号">
                    <el-input v-model="cellInfoForm.siteId" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="网络类型">
                    <el-input v-model="cellInfoForm.networkType" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="eNBID">
                    <el-input v-model="cellInfoForm.enbid" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="本地小区ID">
                    <el-input v-model="cellInfoForm.localCellId" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="ECI">
                    <el-input v-model="cellInfoForm.eci" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="物理小区标识">
                    <el-input v-model="cellInfoForm.physicalCellId" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="PCIMOD3">
                    <el-input v-model="cellInfoForm.pciMod3" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="跟踪区">
                    <el-input v-model="cellInfoForm.tac" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="经度">
                    <el-input v-model="cellInfoForm.longitude" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="纬度">
                    <el-input v-model="cellInfoForm.latitude" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="频段">
                    <el-input v-model="cellInfoForm.frequencyBand" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="频点号">
                    <el-input v-model="cellInfoForm.frequencyPoint" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="带宽">
                    <el-input v-model="cellInfoForm.bandwidth" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="站型">
                    <el-input v-model="cellInfoForm.siteType" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="方位角">
                    <el-input v-model="cellInfoForm.azimuth" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="站高">
                    <el-input v-model="cellInfoForm.stationHeight" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="总俯仰角">
                    <el-input v-model="cellInfoForm.totalPitchAngle" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="内置下倾角">
                    <el-input v-model="cellInfoForm.innerPitchAngle" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="电下倾角">
                    <el-input v-model="cellInfoForm.electronicPitchAngle" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="机械下倾角">
                    <el-input v-model="cellInfoForm.mechanicalPitchAngle" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="厂家">
                    <el-input v-model="cellInfoForm.sprodName" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="半功率角">
                    <el-input v-model="cellInfoForm.hpbw" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="网格信息">
                    <el-input v-model="cellInfoForm.gridInfo" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="类型">
                    <el-input v-model="cellInfoForm.bandType" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="共站名">
                    <el-input v-model="cellInfoForm.commonSiteName" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="扇区名">
                    <el-input v-model="cellInfoForm.sectorName" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="扇区">
                    <el-input v-model="cellInfoForm.sector" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="描述">
                    <el-input v-model="cellInfoForm.description" disabled style="width: 1000px" />
                </el-form-item>
                <el-form-item label="添加时间">
                    <el-input v-model="cellInfoForm.addTime" disabled style="width: 250px" />
                </el-form-item>
                <el-form-item label="enodebOffcsite">
                    <el-input v-model="cellInfoForm.enodebOffcsite" disabled style="width: 250px" />
                </el-form-item>
                <el-form-item label="relatedOffcsite">
                    <el-input v-model="cellInfoForm.relatedOffcsite" disabled style="width: 250px" />
                </el-form-item>
                <el-form-item label="是否远端拉远">
                    <el-input v-model="cellInfoForm.isRemote" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="RRU的DN">
                    <el-input v-model="cellInfoForm.rruModel" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="RRU个数">
                    <el-input v-model="cellInfoForm.rruNumber" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="资管小区名">
                    <el-input v-model="cellInfoForm.ossCellName" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="资管基站名">
                    <el-input v-model="cellInfoForm.ossSiteName" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="物理站ID">
                    <el-input v-model="cellInfoForm.physicalSiteId" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="物理站名称">
                    <el-input v-model="cellInfoForm.physicalSiteName" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="区域类型">
                    <el-input v-model="cellInfoForm.areaType" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="物理站经度">
                    <el-input v-model="cellInfoForm.physicalSiteLongitude" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="物理站纬度">
                    <el-input v-model="cellInfoForm.physicalSiteLatitude" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="塔型">
                    <el-input v-model="cellInfoForm.towerType" disabled style="width: 150px" />
                </el-form-item>
                <el-form-item label="具体塔型">
                    <el-input v-model="cellInfoForm.towerSpecificType" disabled style="width: 150px" />
                </el-form-item>
            </el-form>
        </el-dialog>

        <el-dialog v-model="dialogFormVisible" v-loading="loading" title="导入数据" width="1000" ref="mv"
            @opened="openDialog">
            <el-tabs v-model="activeName">
                <el-tab-pane label="导入数据" name="first">
                    <el-form :model="form" label-width="150px" label-position="left">
                        <el-form-item label="资管工参数据">
                            <el-upload class="upload-demo" :action="uploadOssDataUrl" :on-success="uploadSuccess"
                                :show-file-list="false" :headers="headers">
                                <el-button type="primary">导入</el-button>
                            </el-upload>
                        </el-form-item>
                        <el-form-item label="天面物理站数据">
                            <el-upload class="upload-demo" :action="uploadPhysicalSiteDataUrl"
                                :on-success="uploadSuccess" :show-file-list="false" :headers="headers">
                                <el-button type="primary">导入</el-button>
                            </el-upload>
                        </el-form-item>
                        <el-form-item label="开始分析">
                            <el-button type="primary" @click="startAnalysis">执行</el-button>
                        </el-form-item>
                    </el-form>
                </el-tab-pane>
                <el-tab-pane label="导入记录" name="second">
                    <el-table :data="taskData" style="width: 100%">
                        <el-table-column prop="id" label="id" width="120" align="center" />
                        <el-table-column prop="taskType" label="任务类型" width="150" align="center" />
                        <el-table-column prop="taskStatus" label="任务状态" width="100" align="center" />
                        <el-table-column prop="startDate" label="开始时间" :formatter="dateFormatter" width="180"
                            align="center" />
                        <el-table-column prop="endDate" label="结束时间" :formatter="dateFormatter" width="180"
                            align="center" />
                        <el-table-column prop="result" label="结果" align="center" />
                    </el-table>
                </el-tab-pane>
            </el-tabs>
        </el-dialog>

        <el-dialog v-model="resultDetailDialogVisible" title="查看稽核分析结果" width="1200" @closed="closeResultDialog">
            <el-tabs type="border-card" v-model="resultActiveName" @tab-click="handleClick">
                <el-tab-pane label="信息对比异常数据" name="exceptional">
                    <el-row>
                        <el-button type="primary" @click="exportExceptional" icon="Download"
                            style="margin-bottom: 15px;">导出</el-button>
                    </el-row>
                    <el-table :data="exceptionalTableData" style="width: 100%">
                        <el-table-column type="index" width="50" />
                        <el-table-column prop="county" label="区县" width="120" align="center" />
                        <el-table-column prop="cgi" label="CGI" width="180" align="center" />
                        <el-table-column prop="siteName" label="工参站名" width="200" align="center" />
                        <el-table-column prop="cellName" label="工参小区名" width="200" align="center" />
                        <el-table-column prop="longitude" label="工参经度" width="120" align="center" />
                        <el-table-column prop="latitude" label="工参纬度" width="120" align="center" />
                        <el-table-column prop="stationHeight" label="工参挂高" width="120" align="center" />
                        <el-table-column prop="azimuth" label="工参方位角" width="120" align="center" />
                        <el-table-column prop="ossSiteName" label="资管站名" width="200" align="center" />
                        <el-table-column prop="ossCellName" label="资管小区名" width="200" align="center" />
                        <el-table-column prop="ossLongitude" label="资管经度" width="120" align="center" />
                        <el-table-column prop="ossLatitude" label="资管纬度" width="120" align="center" />
                        <el-table-column prop="ossStationHeight" label="资管挂高" width="120" align="center" />
                        <el-table-column prop="ossAzimuth" label="资管方向角" width="120" align="center" />
                        <el-table-column prop="distance" label="经纬度偏差距离" width="120" align="center" />
                        <el-table-column prop="heightDeviation" label="挂高偏差数" width="120" align="center" />
                        <el-table-column prop="azimuthDeviation" label="方位角偏差数" width="120" align="center" />
                        <el-table-column prop="result" label="问题描述" min-width="200" align="center" />
                    </el-table>
                    <!-- <el-pagination v-model:current-page="exceptionalCurrentPage" v-model:page-size="exceptionalPageSize"
                        :page-sizes="[10, 50, 100, 200]" layout="total, sizes, prev, pager, next"
                        :total="exceptionalTotal" @size-change="listAuditExceptionalData"
                        @current-change="listAuditExceptionalData" /> -->
                    <pagination class="dialog_pagination" v-show="exceptionalTotal > 0" :autoScroll="false"
                        :total="exceptionalTotal" v-model:page="exceptionalCurrentPage"
                        v-model:limit="exceptionalPageSize" @pagination="listAuditExceptionalData" />
                </el-tab-pane>
                <el-tab-pane label="资管缺失数据" name="lack">
                    <el-row>
                        <el-button type="primary" @click="exportLack" icon="Download"
                            style="margin-bottom: 15px;">导出</el-button>
                    </el-row>
                    <el-table :data="lackTableData" style="width: 100%">
                        <el-table-column type="index" width="50" />
                        <el-table-column prop="county" label="区县" width="120" align="center" />
                        <el-table-column prop="cgi" label="CGI" width="180" align="center" />
                        <el-table-column prop="siteName" label="工参站名" width="200" align="center" />
                        <el-table-column prop="cellName" label="工参小区名" width="200" align="center" />
                        <el-table-column prop="longitude" label="工参经度" width="120" align="center" />
                        <el-table-column prop="latitude" label="工参纬度" width="120" align="center" />
                        <el-table-column prop="stationHeight" label="工参挂高" width="120" align="center" />
                        <el-table-column prop="azimuth" label="工参方位角" width="120" align="center" />
                        <el-table-column prop="result" label="问题描述" min-width="200" align="center" />
                    </el-table>
                    <!-- <el-pagination v-model:current-page="lackCurrentPage" v-model:page-size="lackPageSize"
                        :page-sizes="[10, 50, 100, 200]" layout="total, sizes, prev, pager, next" :total="lackTotal"
                        @size-change="listAuditOssLackData" @current-change="listAuditOssLackData" /> -->
                    <pagination class="dialog_pagination" v-show="lackTotal > 0" :autoScroll="false" :total="lackTotal"
                        v-model:page="lackCurrentPage" v-model:limit="lackPageSize"
                        @pagination="listAuditOssLackData" />
                </el-tab-pane>
                <el-tab-pane label="物理站对比异常数据" name="physical">
                    <el-row>
                        <el-button type="primary" @click="exportPhysical" icon="Download"
                            style="margin-bottom: 15px;">导出</el-button>
                    </el-row>
                    <el-table :data="exceptionalPhysicalTableData" style="width: 100%">
                        <el-table-column type="index" width="50" />
                        <el-table-column prop="county" label="区县" width="120" align="center" />
                        <el-table-column prop="cgi" label="CGI" width="180" align="center" />
                        <el-table-column prop="siteName" label="工参站名" width="200" align="center" />
                        <el-table-column prop="cellName" label="工参小区名" width="200" align="center" />
                        <el-table-column prop="longitude" label="工参经度" width="120" align="center" />
                        <el-table-column prop="latitude" label="工参纬度" width="120" align="center" />
                        <el-table-column prop="stationHeight" label="工参挂高" width="120" align="center" />
                        <el-table-column prop="azimuth" label="工参方位角" width="120" align="center" />
                        <el-table-column prop="physicalSiteId" label="物理站编号" width="200" align="center" />
                        <el-table-column prop="physicalSiteName" label="物理站名" width="200" align="center" />
                        <el-table-column prop="physicalSiteLatitude" label="物理站经度" width="120" align="center" />
                        <el-table-column prop="physicalSiteLongitude" label="物理站纬度" width="120" align="center" />
                        <el-table-column prop="distance" label="距离" width="120" align="center" />
                        <el-table-column prop="result" label="问题描述" width="200" align="center" />
                        <el-table-column prop="suggestPhysicalSiteId" label="物理站编号" width="200" align="center" />
                        <el-table-column prop="suggestPhysicalSiteName" label="物理站名" width="200" align="center" />
                        <el-table-column prop="suggestPhysicalSiteLatitude" label="物理站经度" width="120" align="center" />
                        <el-table-column prop="suggestPhysicalSiteLongitude" label="物理站纬度" width="120" align="center" />
                        <el-table-column prop="suggestDistance" label="建议物理站距离" width="120" align="center" />
                    </el-table>
                    <!-- <el-pagination v-model:current-page="exceptionalPhysicalCurrentPage"
                        v-model:page-size="exceptionalPhysicalPageSize" :page-sizes="[10, 50, 100, 200]"
                        layout="total, sizes, prev, pager, next" :total="exceptionalPhysicalTotal"
                        @size-change="listAuditPhysicalExceptionalData"
                        @current-change="listAuditPhysicalExceptionalData" /> -->
                    <pagination class="dialog_pagination" v-show="exceptionalTotal > 0" :autoScroll="false"
                        :total="exceptionalTotal" v-model:page="exceptionalPhysicalCurrentPage"
                        v-model:limit="exceptionalPhysicalPageSize" @pagination="listAuditPhysicalExceptionalData" />
                </el-tab-pane>
            </el-tabs>
        </el-dialog>
    </div>
</template>

<script setup name="audit">

import { ref } from 'vue';

const { proxy } = getCurrentInstance();
const { nhp_network_type, nhp_county_type_short } = proxy.useDict("nhp_network_type", "nhp_county_type_short");
import { getToken } from '@/utils/auth'
import { queryCellsInfoList, queryCellsInfoById, queryAuditExceptionalData, queryAuditOssLackData, queryAuditPhysicalExceptionalData, queryImportTaskList, analysisData } from '@/api/biz/audit';
import { ElDropdownItem, ElLoading, ElMessage, ElMessageBox } from 'element-plus'

const pageSize = ref(10)
const currentPage = ref(1)
const total = ref(0)
const cellInfoTableData = ref([]);

const queryParams = ref({})
const detailDialogVisible = ref(false)
const cellInfoForm = ref({})
const dialogFormVisible = ref(false)
const activeName = ref('first')
const form = ref({})
const uploadOssDataUrl = ref(import.meta.env.VITE_APP_BASE_API + "/audit/importOssData");
const uploadPhysicalSiteDataUrl = ref(import.meta.env.VITE_APP_BASE_API + "/audit/importPhysicalSiteData");
const resultDetailDialogVisible = ref(false)
const exceptionalTableData = ref([])
const exceptionalCurrentPage = ref(1)
const exceptionalPageSize = ref(10)
const exceptionalTotal = ref(0)
const lackTableData = ref([])
const lackCurrentPage = ref(1)
const lackPageSize = ref(10)
const lackTotal = ref(0)
const taskData = ref([])

const exceptionalPhysicalTableData = ref([])
const exceptionalPhysicalCurrentPage = ref(1)
const exceptionalPhysicalPageSize = ref(10)
const exceptionalPhysicalTotal = ref(0)



const resultActiveName = ref("exceptional")

const siteTypeOptions = [
    {
        key: "小区分布",
        value: "小区分布"
    },
    {
        key: "室分",
        value: "室分"
    },
    {
        key: "微站",
        value: "微站"
    },
    {
        key: "外打",
        value: "外打"
    },
    {
        key: "宏站",
        value: "宏站"
    },
]
const headers = ref({ Authorization: "Bearer " + getToken() });

function listCellInfoList() {
    const param = {}
    param.pageSize = pageSize.value;
    param.pageNum = currentPage.value;
    param.county = queryParams.value.county;
    param.networkType = queryParams.value.networkType;
    param.cellName = queryParams.value.cellName;
    param.siteName = queryParams.value.siteName;
    param.siteType = queryParams.value.siteType;
    queryCellsInfoList(param).then(res => {
        cellInfoTableData.value = res.rows
        total.value = res.total
    })
}

function dateFormatter(row, column, cellValue, index) {
    if (!cellValue) { return }
    // 创建一个新的 Date 对象
    var originalDate = new Date(cellValue);

    // 获取年、月、日、时、分、秒
    var year = originalDate.getFullYear();
    var month = ("0" + (originalDate.getMonth() + 1)).slice(-2);
    var day = ("0" + originalDate.getDate()).slice(-2);
    var hours = ("0" + originalDate.getHours()).slice(-2);
    var minutes = ("0" + originalDate.getMinutes()).slice(-2);
    var seconds = ("0" + originalDate.getSeconds()).slice(-2);

    // 格式化输出
    var formattedDateTimeString = year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
    return formattedDateTimeString;
}

function showDetailDialog(id) {
    let params = {
        id: id
    }
    queryCellsInfoById(params).then(res => {
        cellInfoForm.value = res.data
        cellInfoForm.value.addTime = dateFormatter(null, null, res.data.addTime, null)
        detailDialogVisible.value = true
    })
}

function closeDialog() {
    cellInfoForm.value = {}
    detailDialogVisible.value = false
}

function unsetQueryForm() {
    queryParams.value = {}
}

function uploadOssData() {
    dialogFormVisible.value = true;
    form.value = {}
    queryImportTaskList().then(res => {
        taskData.value = res.data
    })
}

function uploadSuccess(res, file, fileList) {
    if (res.data.successFlag) {
        dialogFormVisible.value = false
        ElMessage.success("导入成功")
    } else {
        ElMessage.error(res.data.msg)
    }
}

function showAuditResult() {
    let param = {}
    param.pageSize = exceptionalPageSize.value;
    param.pageNum = exceptionalCurrentPage.value;
    queryAuditExceptionalData(param).then(res => {
        exceptionalTableData.value = res.rows
        exceptionalTotal.value = res.total
        resultDetailDialogVisible.value = true
    })
}

function listAuditExceptionalData() {
    let param = {}
    param.pageSize = exceptionalPageSize.value;
    param.pageNum = exceptionalCurrentPage.value;
    queryAuditExceptionalData(param).then(res => {
        exceptionalTableData.value = res.rows
        exceptionalTotal.value = res.total
    })
}

function closeResultDialog() {
    resultDetailDialogVisible.value = false
    resultActiveName.value = "exceptional"
}

function handleClick(tab) {
    if (tab.props.name == "exceptional") {
        listAuditExceptionalData()
    } else if (tab.props.name == "lack") {
        listAuditOssLackData()
    } else if (tab.props.name == "physical") {
        listAuditPhysicalExceptionalData()
    }
}

function listAuditOssLackData() {
    let param = {}
    param.pageSize = lackPageSize.value;
    param.pageNum = lackCurrentPage.value;
    queryAuditOssLackData(param).then(res => {
        lackTableData.value = res.rows
        lackTotal.value = res.total
    })
}

function listAuditPhysicalExceptionalData() {
    let param = {}
    param.pageSize = exceptionalPhysicalPageSize.value;
    param.pageNum = exceptionalPhysicalCurrentPage.value;
    queryAuditPhysicalExceptionalData(param).then(res => {
        exceptionalPhysicalTableData.value = res.rows
        exceptionalPhysicalTotal.value = res.total
    })
}

function exportExceptional() {
    const param = {}
    proxy.download("/audit/exportAuditExceptionalData", {
        ...param
    }, `信息对比异常列表_${new Date().getTime()}.xlsx`);
}

function exportLack() {
    const param = {}
    proxy.download("/audit/exportAuditOssLackData", {
        ...param
    }, `资管缺失数据列表_${new Date().getTime()}.xlsx`);
}

function exportPhysical() {
    const param = {}
    proxy.download("/audit/exportAuditPhysicalExceptionalData", {
        ...param
    }, `物理站对比异常数据列表_${new Date().getTime()}.xlsx`);
}

function startAnalysis() {
    analysisData().then(res => {
        ElMessage.success("开始执行，请等待结果！")
    })

}

listCellInfoList()

</script>

<style lang="scss" scoped></style>